package com.example.peibei.service.presenter;

import com.dingtao.common.core.DataCall;
import com.dingtao.common.core.WDPresenter;
import com.dingtao.common.core.http.IAppRequest;

import io.reactivex.Observable;

/**
 * @author dingtao
 * @date 2018/12/28 11:23
 * qq:1940870847
 */
public class DynamicPresenter extends WDPresenter<IAppRequest> {
    private int page = 1;

    public int getPage() {
        return page;
    }

    public DynamicPresenter(DataCall dataCall) {
        super(dataCall);
    }

    @Override
    protected Observable getModel(Object... args) {
        boolean refresh = (boolean)args[0];
        if (refresh){
            page = 1;
        }else{
            page++;
        }
        return iRequest.dynamicList((String)args[1],page,20, (String)args[2],(String)args[3]);
    }
}
